<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<%@page import="bit.util.ConnectionContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JDBC 연습</title>
</head>
<body>
<%
String param = request.getParameter("q");
// DB에 쿼리할 SQL문
String sql = "SELECT ? AS msg";
// Connection 얻어오기
Connection conn = ConnectionContext.getConnection();
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setString(1, param);

ResultSet rs = pstmt.executeQuery();

String msg = null;
if (rs.next()) {
	msg = rs.getString("msg");
}

pstmt.close();
%>

쿼리문: <%= sql %><br/>
쿼리결과: <%= msg %>

</body>
</html>